import 'package:flutter/material.dart';
import 'package:lib_uikit/generated/l10n.dart';
import 'package:lib_uikit/lib_uikit.dart';
import 'package:lib_uikit/resource/resources.dart';

class GTEmptyDataView extends StatelessWidget {
  final String? title;
  final Widget? icon;
  final bool iconCenter;
  final Widget? button;
  final double topPadding;

  const GTEmptyDataView({super.key, this.title, this.icon, this.button, this.topPadding = 60, this.iconCenter = true});

  @override
  Widget build(BuildContext context) {
    return Column(
      mainAxisSize: iconCenter ? MainAxisSize.max : MainAxisSize.min,
      mainAxisAlignment: iconCenter ? MainAxisAlignment.center : MainAxisAlignment.start,
      crossAxisAlignment: CrossAxisAlignment.stretch,
      children: [
        SizedBox(height: iconCenter ? 0 : topPadding),
        icon ?? Image.asset(Images.emptyNodata, height: 120, width: 120),
        const SizedBox(height: 16),
        Text(
          title ?? LibUIKitS.of(context).no_data,
          style: TextStyle(color: GTColors.uikitText3.color, fontSize: 14),
          textAlign: TextAlign.center,
        ),
        if (button != null) Padding(padding: const EdgeInsets.only(top: 24), child: button),
      ],
    );
  }
}
